package com.cw.jeeyt.dao.impl.system;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.cw.jeeyt.dao.intf.system.SystemModuleInfoDao;
import com.cw.jeeyt.dao.mapper.system.SystemModuleInfoMapper;
import com.cw.jeeyt.dao.model.system.SystemModuleInfoDo;
import com.cw.lang.common.utils.PageUtil;
import com.cw.lang.common.pagehelper.PageHelper;
import com.cw.lang.mybatis.dto.PageInfo;

/**
 * 模块信息 dao数据库操作接口
 * @author chenw
* @version 1.0.0
 */
@Repository
public class SystemModuleInfoDaoImpl implements SystemModuleInfoDao {
    @Autowired
    private SystemModuleInfoMapper systemModuleInfoMapper;

    /**
     * 查询所有模块信息
     *
     * @return 模块信息集合
     */
    @Override
    public List<SystemModuleInfoDo> querySystemModuleInfoList() {
        return systemModuleInfoMapper.querySystemModuleInfoList();
    }

    /**
     * 删除模块信息
     *
     * @param systemModuleInfo
     */
    @Override
    public void deleteSystemModuleInfo(SystemModuleInfoDo systemModuleInfo) {
        systemModuleInfoMapper.deleteSystemModuleInfo(systemModuleInfo);
    }

    /**
     * 修改模块信息
     *
     * @param systemModuleInfo
     */
    @Override
    public void updateSystemModuleInfo(SystemModuleInfoDo systemModuleInfo) {
        systemModuleInfoMapper.updateSystemModuleInfo(systemModuleInfo);
    }

    /**
     * 根据主键查询模块信息
     *
     * @param id 主键id
     * @return SystemModuleInfo
     */
    @Override
    public SystemModuleInfoDo getSystemModuleInfoById(String id) {
        return systemModuleInfoMapper.getSystemModuleInfoById(id);
    }

    /**
     * 新增模块信息
     *
     * @param systemModuleInfo
     * @return 整数
     */
    @Override
    public Integer insertSystemModuleInfo(SystemModuleInfoDo systemModuleInfo) {
        return systemModuleInfoMapper.insertSystemModuleInfo(systemModuleInfo);
    }

    /**
     * 分页查询模块信息
     *
     * @param systemModuleInfo 查询条件
     * @param startNum 开始条数
     * @param pageSize 每页长度
     * @return SystemModuleInfo集合
     */
    @Override
    public PageInfo<SystemModuleInfoDo> queryByPage(SystemModuleInfoDo systemModuleInfo, Integer startNum,
        Integer pageSize) {
        PageHelper.startPage(PageUtil.calPageNum(startNum, pageSize), pageSize);
        return new PageInfo<>(systemModuleInfoMapper.queryByPage(systemModuleInfo));
    }

    /**
     * 根据项目id查询模块信息
     */
    @Override
    public List<SystemModuleInfoDo> querySystemModuleInfoListByProjectId(String projectId) {
        return systemModuleInfoMapper.querySystemModuleInfoListByProjectId(projectId);
    }

}
